package com.onpositive.wikitemplate;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;

public class TemplateInfoProvider {
	
	private static String path = "C:/wikistorage/templates/service/garbage.txt" ;
	
	private HashSet<String> set = new HashSet<String>() ; 
	
	public TemplateInfoProvider() {
		super();
		
		try {
			BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream( path ), "UTF-8") ) ;
			while (true){
				String str = reader.readLine();
				if ( str == null ){
					break;
				}
				set.add( normalize(str) ) ;
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}		
	}

	public boolean needToBeKilled( String str )
	{		
		return set.contains( normalize(str) ) ;		
	}

	public String normalize(String str) {
		return str.toLowerCase().trim();
	}
}
